<template>
  <div class="app-container">
    <div class="filter-container">
      <el-date-picker v-model="date" class="filter-item" type="date" style="width: 160px;" placeholder="时间"></el-date-picker>
      <el-button class="filter-item" type="primary" plain icon="el-icon-search" @click="handleFilter">搜索</el-button>
    </div>
    <el-table v-loading="listLoading" :data="list" class="mt-10" stripe border>
      <el-table-column label="服务器" prop="sid_str" width="150px" align="center"></el-table-column>
      <el-table-column label="开服日期" prop="open_date" width="100px" align="center"></el-table-column>
      <el-table-column label="累计注册" prop="total_register" width="70px" align="center"></el-table-column>
      <el-table-column label="累计创角" prop="total_actor" width="70px" align="center"></el-table-column>
      <el-table-column label="累计充值人数" prop="total_recharge_num" width="90px" align="center"></el-table-column>
      <el-table-column label="累计充值金额" prop="total_recharge_amount" width="90px" align="center"></el-table-column>
      <el-table-column label="总付费率" prop="total_pay_ratio" width="80px" align="center"></el-table-column>
      <el-table-column label="总ARPU" prop="total_arpu" width="80px" align="center"></el-table-column>
      <el-table-column label="总ARPPU" prop="total_arppu" width="80px" align="center"></el-table-column>
      <el-table-column label="当日注册" prop="register" width="80px" align="center"></el-table-column>
      <el-table-column label="当日活跃" prop="dau" width="80px" align="center"></el-table-column>
      <el-table-column label="当日充值人数" prop="recharge_num" width="80px" align="center"></el-table-column>
      <el-table-column label="当日充值金额" prop="recharge_amount" width="80px" align="center"></el-table-column>
      <el-table-column label="当日付费率" prop="recharge_ratio" width="80px" align="center"></el-table-column>
      <el-table-column label="当日ARPU" prop="aupu" width="80px" align="center"></el-table-column>
      <el-table-column label="当日ARPPU" prop="arppu" width="80px" align="center"></el-table-column>
      <el-table-column label="当日最高在线" prop="max_online" width="90px" align="center"></el-table-column>
      <el-table-column label="当日平均在线" prop="avg_online" width="90px" align="center"></el-table-column>
    </el-table>
  </div>
</template>

<script>
import { getServerReport } from '@/api/statis'

export default {
  name: 'ReportServer',
  data() {
    return {
      list: [],
      listLoading: false,
      date: new Date()
    }
  },
  created() {
    this.getList()
  },
  methods: {
    handleFilter() {
      this.getList()
    },
    async getList() {
      this.listLoading = true
      const res = await getServerReport({ date: this.date })
      this.listLoading = false
      this.list = res.data
    }
  }
}
</script>
